Answer:

1  3  5  7  9 

Just after "9" is printed, the NEXT ODD statement changes ODD from 9 to 11. But 11 is GREATER THAN the ending value 9, so the loop ends.

Overshooting the Ending Value

Here is the program again, but with the ending value changed to a value that ODD will never become:

'
FOR ODD = 1 TO 6 STEP 2
  PRINT ODD;
NEXT ODD
'
END

The STEP 2 means that 2 is added to ODD every time control gets to the NEXT ODD. So possible values for ODD are: 1, 3, 5, 7, 9, and so on. The ending value 6 is never "hit" exactly. When does the loop end?

The rule is: if the loop is counting UPWARD, the loop ends as soon as the counter IS GREATER THAN endingValue.

                            time -->
                            
FOR ODD = 1 TO 6 STEP 2     1       3       5       7 <-- exceeds the limit, 6,   
  PRINT ODD;                  1       3       5            so the loop stops
NEXT ODD                        3       5       7
'
END

So the program prints

1  3  5

as before.

QUESTION 8:

Leap years occur every four years. (Except for century years, which must be divisible by 400 in order to be leap years.) Write a program that prints out the leap years from 1964 to 2000. (Hint: use a FOR loop with a starting value of 1964.)